local cemouzhike = fk.CreateSkill{
    name = "ym2__cemouzhike",
}
Fk:loadTranslationTable{
    ["ym2__cemouzhike"] = "策谋之刻",
    [":ym2__cemouzhike"] = "若你使用过五张同类型的即时牌，你可以视为使用一张相同类型的牌，并重置此技能。",
    ["@[ym2__cemouzhike]basic"] = "",
    ["@[ym2__cemouzhike]trick"] = "",

    ["$ym2__cemouzhike1"] = "天下如棋，一步三算！",
    ["$ym2__cemouzhike2"] = "一切都在计算中！",
}
Fk:addQmlMark{
    name = "ym2__cemouzhike",
    how_to_show = function (name, value, player)
        local number = tonumber(value)
        local str = "策谋基本"
        if name == "@[ym2__cemouzhike]trick" then str = "策谋锦囊" end
        if number < 5 then
            return str.." "..tostring(number)
        else
            return "<font color='#6fb8cc'>"..str.." "..tostring(number).."</font>"
        end
    end,
    qml_path = "",
}
cemouzhike:addEffect("viewas",{
    pattern = ".",
    interaction = function (self, player)
        local choices = {}
        if player:getMark("@[ym2__cemouzhike]basic") >= 5 then
            table.insertTable(choices,Fk:getAllCardNames("b"))
        end
        if player:getMark("@[ym2__cemouzhike]trick") >= 5 then
            table.insertTable(choices,Fk:getAllCardNames("t"))
        end
        choices = player:getViewAsCardNames(cemouzhike.name, choices)
        if #choices == 0 then return end
        return UI.CardNameBox { choices = choices }
    end,
    card_filter = Util.FalseFunc,
    view_as = function (self, player, cards)
        if not self.interaction.data then return end
        local card = Fk:cloneCard(self.interaction.data)
        card.skillName = cemouzhike.name
        return card
    end,
    before_use = function (self, player, use)
        player.room:setPlayerMark(player,"@[ym2__cemouzhike]basic",0)
        player.room:setPlayerMark(player,"@[ym2__cemouzhike]trick",0)
    end,
    enabled_at_play = function (self, player)
        local choices = {}
        if player:getMark("@[ym2__cemouzhike]basic") >= 5 then
            table.insertTable(choices,Fk:getAllCardNames("b"))
        end
        if player:getMark("@[ym2__cemouzhike]trick") >= 5 then
            table.insertTable(choices,Fk:getAllCardNames("t"))
        end
        choices = player:getViewAsCardNames(cemouzhike.name, choices)
        return #choices > 0
    end,
    enabled_at_response = function (self, player, response)
        local choices = {}
        if player:getMark("@[ym2__cemouzhike]basic") >= 5 then
            table.insertTable(choices,Fk:getAllCardNames("b"))
        end
        if player:getMark("@[ym2__cemouzhike]trick") >= 5 then
            table.insertTable(choices,Fk:getAllCardNames("t"))
        end
        choices = player:getViewAsCardNames(cemouzhike.name, choices)
        return not response and #choices > 0
    end,
})
cemouzhike:addEffect(fk.CardUsing,{
    can_refresh = function (self, event, target, player, data)
        return target == player and player:hasSkill(cemouzhike.name) and (data.card.type == Card.TypeBasic or data.card:isCommonTrick())
    end,
    on_refresh = function (self, event, target, player, data)
        local room = player.room
        if data.card.type == Card.TypeBasic then
            if player:getMark("@[ym2__cemouzhike]basic") < 5 then
                room:addPlayerMark(player,"@[ym2__cemouzhike]basic",1)
                p(type(player:getMark("@[ym2__cemouzhike]basic")))
            end
        elseif player:getMark("@[ym2__cemouzhike]trick") < 5 then
            room:addPlayerMark(player,"@[ym2__cemouzhike]trick",1)
        end
    end,
})
return cemouzhike